<?php
// +----------------------------------------------------------------------
// | Fanwe 方维订餐小秘书商业系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011 http://www.fanwe.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: 云淡风轻(88522820@qq.com)
// +----------------------------------------------------------------------

class brandModule extends StoreBaseModule
{
	//品牌招商页面
	public function index()
	{
		$GLOBALS['tmpl']->caching = true;
		$cache_id  = md5(MODULE_NAME.ACTION_NAME.trim($_REQUEST['id']).$GLOBALS['deal_city']['id']);		
		if (!$GLOBALS['tmpl']->is_cached('store_brand.html', $cache_id))	
		{	
			$site_nav[] = array('name'=>$GLOBALS['lang']['HOME_PAGE'],'url'=>url("index","index"));
			$site_nav[] = array('name'=>$GLOBALS['lang']['STORE_BRAND'],'url'=>url("store","brand"));
			$GLOBALS['tmpl']->assign("site_nav",$site_nav);
			$title = $GLOBALS['lang']['STORE_BRAND'];
				
			
			$cate_list = $GLOBALS['db']->getAll("select * from ".DB_PREFIX."deal_cate where is_delete = 0 and is_effect = 1 order by sort desc");
			
			
			$city_id = intval($GLOBALS['deal_city']['id']);
			if($city_id>0)
			{			
					$ids = load_auto_cache("deal_city_belone_ids",array("city_id"=>$city_id));				
					if($ids)
					$city_condition = " and city_id in (".implode(",",$ids).")";
	
			}
			foreach($cate_list as $k=>$v)
			{
				$cate_list[$k]['store_list'] = $GLOBALS['db']->getAll("select * from ".DB_PREFIX."supplier_location where deal_cate_id = ".$v['id']." and is_verify = 1 and is_effect = 1 and is_recommend = 1 $city_condition limit 15");
			}
			
			
			$GLOBALS['tmpl']->assign("cate_list",$cate_list);	
			$GLOBALS['tmpl']->assign("page_title",$title);	
			$GLOBALS['tmpl']->assign("page_keyword",$title.",");		
			$GLOBALS['tmpl']->assign("page_description",$title.",");
			
		}
		$GLOBALS['tmpl']->display("store_brand.html",$cache_id);		
	}
	
}
?>